﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using ScheduledEmailsToSendTableAdapters;

/// <summary>
/// Summary description for ScheduledEmailsToSendBLL
/// </summary>
[System.ComponentModel.DataObject] 
public class ScheduledEmailsToSendBLL
{
    ILE_Global ileGlobal = new ILE_Global();

    private ScheduledEmailsToSendTableAdapter _adapter = null;
    protected ScheduledEmailsToSendTableAdapter Adapter
    {
        get
        {
            if (_adapter == null)
                _adapter = new ScheduledEmailsToSendTableAdapter();

            return _adapter;
        }
    }

    [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Select, true)]
    public ScheduledEmailsToSend.ScheduledEmailsToSendDataTable GetScheduledEmailsToSend()
    {
        return Adapter.GetScheduledEmailsToSend();
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="AssignmentID"></param>
    /// <param name="EventType">Starts, BeforeDue, Results</param>
    /// <param name="CourseID"></param>
    /// <param name="SectionNumber"></param>
    /// <param name="SendDateTime"></param>
    /// <returns></returns>
    [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Insert, false)]
    public bool InsertScheduledEmailToSend(int AssignmentID, string EventType, int CourseID, int SectionNumber, DateTime SendDateTime)
    {
        return Adapter.Insert(AssignmentID, EventType, CourseID, SectionNumber, SendDateTime) == 1;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="AssignmentID"></param>
    /// <param name="EventType">Starts, BeforeDue, Results</param>
    /// <returns></returns>
    [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Delete, true)]
    public bool DeleteScheduledEmailToSend(int AssignmentID, string EventType, int CourseID, int SectionNumber)
    {
        try
        {
            return Adapter.Delete(AssignmentID, EventType, CourseID, SectionNumber) == 1;
        }
        catch (Exception ex)
        {
            ileGlobal.RecordError("ScheduledEmailsToSendBLL:DeleteScheduledEmailToSend:000", ex, 3);
            return false;
        }
    }
}
